#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <string>

using namespace std;

int main(int argc, char** argv) {
	int i, j, k, l;
	int base;
	string benchmark = argv[1];
	string cmd = "./RUN" + benchmark;
	cmd += " ../../simplesim-3.0/sim-outorder ../../spec2000binaries/";
	cmd += benchmark;
	cmd += "00.peak.ev6 -max:inst 50000000 -fastfwd 20000000 -redir:sim snap_";
	cmd += benchmark;
	cmd += "_";
	
	for(i = 0; i < 3; i++) {
		ostringstream stm_t;	//default threshold
		stm_t << i*5;
		base = 1;
		for(j = 0; j < 7; j++) {
			ostringstream stm_sv;	//saturated value
			stm_sv << base;
			for(k = 1; k < 2; k++) {
				ostringstream stm_w;	//scalable
				stm_w << k;
				for(l = 1; l < 2; l++) {
					ostringstream stm_b;	//biased
					stm_b << l;
					string ccmd = cmd;
					ccmd += stm_b.str();
					ccmd += "_";
					ccmd += stm_t.str();
					ccmd += "_";
					ccmd += stm_sv.str();
					ccmd += "_";
					ccmd += stm_w.str();
					ccmd += ".txt -bpred snap -bpred:snap ";
					ccmd += stm_b.str();
					ccmd += " ";
					ccmd += stm_t.str();
					ccmd += " ";
					ccmd += stm_sv.str();
					ccmd += " ";
					ccmd += stm_w.str();
	        			system(ccmd.c_str());
	        		}
	        	}
        		base *=2;
        	}
	}

	return 0;
}